package com.hziee.mail.model;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "sku_info", schema = "mall", catalog = "")
public class SkuInfo {
    private int skuId;
    private String productClassId;
    private int amount;
    private double price;
    private int sellerId;
    private int saleNumber;

    @Id
    @Column(name = "sku_id")
    public int getSkuId() {
        return skuId;
    }

    public void setSkuId(int skuId) {
        this.skuId = skuId;
    }

    @Basic
    @Column(name = "product_class_id")
    public String getProductClassId() {
        return productClassId;
    }

    public void setProductClassId(String productClassId) {
        this.productClassId = productClassId;
    }

    @Basic
    @Column(name = "amount")
    public int getAmount() {
        return amount;
    }

    public void setAmount(int amount) {
        this.amount = amount;
    }

    @Basic
    @Column(name = "price")
    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    @Basic
    @Column(name = "seller_id")
    public int getSellerId() {
        return sellerId;
    }

    public void setSellerId(int sellerId) {
        this.sellerId = sellerId;
    }

    @Basic
    @Column(name = "sale_number")
    public int getSaleNumber() {
        return saleNumber;
    }

    public void setSaleNumber(int saleNumber) {
        this.saleNumber = saleNumber;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SkuInfo skuInfo = (SkuInfo) o;
        return skuId == skuInfo.skuId &&
                amount == skuInfo.amount &&
                Double.compare(skuInfo.price, price) == 0 &&
                sellerId == skuInfo.sellerId &&
                saleNumber == skuInfo.saleNumber &&
                Objects.equals(productClassId, skuInfo.productClassId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(skuId, productClassId, amount, price, sellerId, saleNumber);
    }
}
